<template>
    <div>
        <el-form :model="ruleForm" ref="ruleForm" :label-position="labelPosition" label-width="120px" class="demo-ruleForm">
            <div class="container" style="margin-top:20px">
                <h3 style="margin-bottom: 20px">{{ruleForm.breedName}}</h3>
                <el-row>
                    <el-col :span="12">
                        <el-form-item label="物料类型：">
                            {{ruleForm.materialType}}
                        </el-form-item>
						<el-form-item label="产品大类：" v-if="keliShow">
							{{ruleForm.inventoryType}}
						</el-form-item>
                        <el-form-item label="物料代码：" >
                            {{ruleForm.materialCode}}
                        </el-form-item>
                        <div v-if="keliShow">
                            <el-form-item label="发药机编码：">
                                {{ruleForm.dispenserCode}}
                            </el-form-item>
                         
                            <el-form-item label="规格：" prop="spec">
                                {{ruleForm.loadingQuantity}}g
                                
                            </el-form-item>
                             <el-form-item label="规格对应饮片：" class="styleWidth">
                                {{ruleForm.ypQuantity}}g
                            </el-form-item>
                            <el-form-item label="上市备案号：">
                                {{ruleForm.prodRecordCode}}
                            </el-form-item>
                        </div>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="名称：">
                            {{ruleForm.breedName}}
                        </el-form-item>
                        <div v-if="keliShow">
                            <el-form-item label="存货代码：">
                                {{ruleForm.inventoryCode}}
                            </el-form-item>
                            <el-form-item label="装量：">
                                {{ruleForm.pelletWeight}}{{ruleForm.loadingUnits}}
                            </el-form-item>
                        </div>
						<el-form-item label="保质期：">
						    {{ruleForm.deadLine}}月
						</el-form-item>
                        <div v-if="keliShow">
                           
                            <el-form-item label="贮藏：">
                                {{ruleForm.storage}}
                            </el-form-item>
                        </div>
                    </el-col>
                </el-row>
                <el-form-item class="footerFixed">
                    <el-button @click="backPage">返回</el-button>
                </el-form-item>
            </div>
        </el-form>
    </div>
</template>


<script>
import {materialBreed_findById} from "@/request/api";
import uploadImg from '../../../common/uploadImg';
    export default {
        components: {
            uploadImg
        },
        data() {
            return {
                labelPosition:'right',
                showForm: false,
                keliShow: false,
                isDisabled: true,
                wlShow: false,
                ruleForm: {
                    breedName:'',
                    place: '',
                    materialType: '',
                    loadingQuantity: '',
                    loadingUnits: 'g',
                    spec: '',
                    specUnits: '',
                    dispenserCode: '',
                    inventoryCode: '',
                    ypQuantity: '',
                    ypUnits: 'g',
                },
                materialTypeStor: ''
            };
        },
        mounted(){
            this.id = this.$route.query.id
            if(this.id == undefined){
                
                }else{
                    this.init()
            }
        },
        methods: {
            backPage () {
                this.$router.go(-1);
                this.ruleForm = {}
                this.$store.commit('setStorName',this.materialTypeStor)
            },
            //  查看状态
            init(){
                // 回显表单
                materialBreed_findById(this.id).then((res) => {
                    this.ruleForm = res.data;
                    if (res.data.materialType == '配方颗粒') {
                        this.keliShow = true
                        this.wlShow = false
                    }
                    // else if(res.data.materialType == '提取饮片'){
                    //     this.wlShow = true
                    //     this.keliShow = false
                    // }
                    else{
                        this.keliShow = false
                        this.wlShow = false
                    }
                    this.materialTypeStor = this.ruleForm.materialType
                })
            },
        }
    }
</script>
<style lang="less">
.styleWidth .el-input-group>.el-input__inner{ width: 200px !important;}
.styleWidth .el-select{ width: 60px !important;}
// .delete_btn{
//     margin-left:6px;
// }
</style>